package kt.com.bilin.coin.helper.mohsi

import com.squareup.moshi.Types

object MoshiUtils {
    @JvmStatic
    fun toJSONString(any: Any) = MOSHI.adapter(any.javaClass).toJson(any)

    @JvmStatic
    fun <T> parseObject(text: String, clz: Class<T>) = MOSHI.adapter(clz).fromJson(text)

    @JvmStatic
    fun <T> parseArray(text: String, clz: Class<T>) = MOSHI.adapter<ArrayList<T>>(Types.newParameterizedType(ArrayList::class.java, clz)).fromJson(text)
}